<!DOCTYPE html SYSTEM "about:legacy-compat">
<html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><link href="../images/docs-stylesheet.css" rel="stylesheet" type="text/css"><title>Apache Tomcat 9 Architecture (9.0.93) - Startup</title><meta name="author" content="Yoav Shapira"></head><body><div id="wrapper"><header><div id="header"><div><div><div class="logo noPrint"><a href="https://tomcat.apache.org/"><img alt="Tomcat Home" src="../images/tomcat.png"></a></div><div style="height: 1px;"></div><div class="asfLogo noPrint"><a href="https://www.apache.org/" target="_blank"><img src="../images/asf-logo.svg" alt="The Apache Software Foundation" style="width: 266px; height: 83px;"></a></div><h1>Apache Tomcat 9 Architecture</h1><div class="versionInfo">
            Version 9.0.93,
            <time datetime="2024-08-02">Aug 2 2024</time></div><div style="height: 1px;"></div><div style="clear: left;"></div></div></div></div></header><div id="middle"><div><div id="mainLeft" class="noprint"><div><nav><div><h2>Links</h2><ul><li><a href="../index.html">Docs Home</a></li><li><a href="index.html">Architecture Home</a></li><li><a href="https://cwiki.apache.org/confluence/display/TOMCAT/FAQ">FAQ</a></li><li><a href="#comments_section">User Comments</a></li></ul></div><div><h2>Contents</h2><ul><li><a href="index.html">Contents</a></li><li><a href="overview.html">Overview</a></li><li><a href="startup.html">Server Startup</a></li><li><a href="requestProcess.html">Request Process</a></li></ul></div></nav></div></div><div id="mainRight"><div id="content"><h2>Startup</h2><h3 id="Server_Startup">Server Startup</h3><div class="text">

<p>
This page describes how the Tomcat server starts up.  There are several
different ways to start tomcat, including:
</p>
<ul>
  <li>From the command line.</li>
  <li>From a Java program as an embedded server.</li>
  <li>Automatically as a Windows service.</li>
</ul>

<div class="subsection"><h4 id="description">description</h4><div class="text">
<p>
A <a href="startup/serverStartup.txt">text description</a> of the startup
procedure created for Tomcat 5. The updated version of this description for
Tomcat 11 will be included in the updated diagrams and diagram descriptions in
the following section. This text file will be removed when that update is
complete.
</p>
</div></div>

<div class="subsection"><h4 id="diagram">diagram</h4><div class="text">
<p>
The <a href="startup/serverStartup.pdf">UML sequence diagram</a> of the startup
procedure created for Tomcat 5 is gradually being replaced with updated diagrams
based on Tomcat 11. The scope of these diagrams may be adjusted as they are
produced.
</p>
<p>
A series of UML diagrams have been created to document the start-up process for
Tomcat.
</p>
<p>
<a href="startup/1_overview.png">Diagram 1</a> shows an overview of how Tomcat
start, serves requests and then stops. Once the class loaders have been
initialized, Tomcat parses server.xml using the Digester and the Digester
creates the objects defined in server.xml, configures them using the property
values defined in server.xml and the starts the Server. The main Java thread
waits in the await() method for a shutdown signal. Once a shutdown signal is
received, the Server object is stopped and then destroyed. The JVM then exits.
</p>
<p>
Diagram 2 will show how the Server initialises the Connectors and associated
objects.
</p>
<p>
Diagram 3 will show how the Server initialises the Service(s), Engine(s) and
Host(s).
</p>
<p>
Diagram 4 will show how the Host initialises the Context(s).
</p>
<p>
Diagram 5 will show how the Context initialises the Filters, Servlets etc.
</p>
</div></div>

<div class="subsection"><h4 id="comments">comments</h4><div class="text">
<p>
The startup process can be customized in many ways, both
by modifying Tomcat code and by implementing your own
LifecycleListeners which are then registered in the server.xml
configuration file.
</p>

</div></div>

</div></div></div></div></div><footer><div id="footer">
    Copyright &copy; 1999-2024, The Apache Software Foundation
    <br>
    Apache Tomcat, Tomcat, Apache, the Apache Tomcat logo and the Apache logo
    are either registered trademarks or trademarks of the Apache Software
    Foundation.
    </div></footer></div></body></html>